IF (req:=AllocAslRequest(ASL_FILEREQUEST,[ASL_HAIL,'Choose Module(s) to extract from',ASL_WIDTH,350,ASL_DIR,'ram:',ASL_FUNCFLAGS,FILF_MULTISELECT,0]:tagitem))>0
DEF req:PTR TO filerequestr,lock,a,work[256]:STRING,result,file[256]:STRING
IF EstrLen(sample_path)=0
IF (req:=AllocAslRequest(ASL_FILEREQUEST,[ASL_HAIL,'Choose a directory to save samples to',ASL_WIDTH,350,ASL_EXTFLAGS1,FIL1F_NOFILES,ASL_FUNCFLAGS,FILF_SAVE,ASL_DIR,'ram:',0]:tagitem))>0
WriteF('Saving:\s[20] To \s\n',sampname[sampnum],filename)
IF (fh:=Open(filename,NEWFILE))>0
Write(fh,sampptr[sampnum],samplen[sampnum])
Close(fh)
ELSE
WriteF('Unable to open file \s\n',sampname[sampnum])
ENDIF
ENDPROC
/*
This procedure changes illegal characters in a string to '.' and removes
ST-xx: prefixes...
*/
PROC cleanupstring(str:PTR TO CHAR)
DEF a,off=0
IF (a:=InStr(str,':',0))>-1
MidStr(str,str,a+1,ALL)
ENDIF
REPEAT
a:=InStr(str,':',off)
IF a=-1
a:=InStr(str,'/',off)
ENDIF
IF a>-1
str[a]:="." ; off:=a
ENDIF
UNTIL a=-1
ENDPROC
PROC renamefile(file)
DEF req:PTR TO filerequestr
IF (req:=AllocAslRequest(ASL_FILEREQUEST,[ASL_HAIL,'Save sample as:',ASL_WIDTH,350,ASL_DIR,sample_path,ASL_FILE,FilePart(file),ASL_FUNCFLAGS,FILF_SAVE,0]:tagitem))>0